<template>
    <div>
        <h6>Child2</h6>
        <button @click="sendMessage">给 child1 发消息</button>
        <p>{{$attrs}}</p>
        <p>{{$listeners}}</p>
        <p>{{foo}}</p>

    </div>
</template>

<script>
export default {
  inject: ["foo"],
  methods: {
    sendMessage() {
      //   this.$bus.$emit("event-from-child2", "Hi brother child1,I am child2");
      this.$parent.$emit("event-from-child2", "Hi brother child1,I am child2");
    }
  }
};
</script>

<style lang="scss" scoped>
</style>